user_0 = {
    'username':'efermi',
    'first':'enrico',
    'last':'fermi',
}
for key,value in user_0.items():
    print(f"\nKey:{key}")
    print(f"Value:{value}")

favorite_languages = {
    'jen':'python',
    'sarah':'c',
    'edward':'ruby',
    'phil':'python',
    #'erin':'python',
}
for name,language in favorite_languages.items():
    print(f"{name.title()}'s favorite language is {language.title()}")

for name in favorite_languages.keys():
    print(name.title())

friends = ['phil','sarah']
for name in favorite_languages.keys():
    print(f"Hi {name.title()}.")
    if name in friends:
        language = favorite_languages[name].title()
        print(f"\t{name.title()},I see you love {language}!")

if 'erin' not in favorite_languages.keys():
    print("Erin, please take our poll!")

for name in sorted(favorite_languages.keys()):
    print(f"{name.title()}, thank you for taking the poll.")

print("The following languages have been mentioned:")
for language in favorite_languages.values():
    print(language.title())

print("The following language have been mentioned:")
for language in set(favorite_languages.values()):
    print(language.title())

#练习
#6-4
code_dictionary = {
    'int':'整型值',
    'if':'判断语句',
    'while':'while循环',
    'range()':'数值范围',
    'for':'for循环'
}
for k in code_dictionary.keys():
    print(f"{k}:")
for v in code_dictionary.values():
    print(v)

#6-6
favorite_languages = {
    'jen':'python',
    'sarah':'c',
    'edward':'ruby',
    'phil':'python',
}
vote_peoples = ['jen','phil','sarch','sam','lisa']
for vote_people in vote_peoples:
    if vote_people in favorite_languages.keys():
        print(f"{vote_people}, thank you !")
    else:
        print(f"{vote_people}, we hope you join my vote!")